$(function () {
    $(".target.campaign_empty_free").on("tap", function (e) {
        Toast.showWait();
        $.ajax({
            type: "GET",
            url: baseurl + "campaign-default",
            timeout:5000,
            data: {
                mac: mac,
                nasid: nasid,
                name_device: name_device,
                id_campaign: id_campaign,
                landing_page: landing_page,
                id_place: id_place,
                type_time_session: type_time_session
            },
            success: function (data) {
                if (data == '200') {
                    Toast.showMessage({typeMessage: 'success'});
                    setTimeout(function () {
                        Toast.close();
                        Toast.showWait({text: "Truy cập internet...", width: "150px"});
                        location.href = authentication_link;
                    }, 1000);
                } else {
                    setTimeout(function () {
                        Toast.close();
                        Toast.show({text: "Có lỗi hệ thống."});
                    }, 300);
                }
            },
            error: function () {
                Toast.close();
                Toast.show({text: "Xảy ra lỗi, vui lòng thử lại."});
            }
        });
        e.preventDefault();
    });
});